home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / musictex / older-versions / musictex.500 / MUSIKGEN.MF < prev    next >
Text File  |  1994-02-01  |  35KB  |  1,234 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %  this is musikgen.mf
  3. %
  4. %  Version 5.01 [January 94] Deaniel Taupin
  5. %
  6. %  Version 4.89 [September 93] Andreas Egler
  7. %               - blacker influence now
  8. %               - redesigned chars 71, 72, 53, 123
  9. %
  10. %  Version 4.88 [January 93] Ross Mitchell
  11. %               - redesigned chars 63, 64, 65, 66
  12. %
  13. %  Version 4.87 [] Daniel Taupin
  14. %
  15. %  Version 2.00 [] Daniel Taupin
  16. %
  17. %  Version 1.00 [August 86] Angelika Schofer/Andrea Steinbach
  18. %
  19. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20.  
  21. %"At most 15 different nonzero heights, 15 different nonzero depths, ...
  22. % may appear in a single fonts. If these limits are exceeded, METAFONT will
  23. % change one or more values, ..., until the restriction hold. A warning
  24. % message is issued ..; for example 'some charht values had to be adjusted
  25. % by as much as 0.12pt' means that you had too many different nonzero
  26. % heights, ..."                                        METAFONT-Book App. F
  27.  
  28. %<<<>>> This indicates the heights I've changed
  29.  
  30. %{{{ This always indicates a lowres fix to avoid seperated points
  31. %}}} and/or 'invisible' lines. It doesn't affect higher resolutions !!
  32.  
  33. pair pone, ptwo;
  34. transform t;
  35. path p;
  36. picture save_pic;
  37.  
  38. pen thin_pen, med_pen;
  39. thin_pen:= pencircle scaled thin;
  40. med_pen:= pencircle scaled med;
  41.  
  42. apog_fact=0.75;
  43. apog_nhh=apog_fact*nhh;
  44. apog_nhh#=apog_fact*nhh#;
  45. apog_nhw#=apog_fact*nhw#;
  46.  
  47. %%%AE it's somewhat faster to use already computed pictures
  48. def mirror (expr pone, ptwo) =
  49.     currentpicture:=currentpicture reflectedabout(round(pone),round(ptwo))
  50. enddef;
  51. def add_mirror (expr pone, ptwo) =
  52.     addto currentpicture also currentpicture 
  53.           reflectedabout (round(pone), round(ptwo))
  54. enddef;
  55.  
  56. def savepic = save_pic:= currentpicture enddef;
  57. def callpic = currentpicture:= save_pic enddef;
  58. def clearpic = save_pic:= nullpicture enddef;
  59.  
  60. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  61. % basic macros for noteheads and flags %
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. % noteheads %
  64. %%%%%%%%%%%%%
  65. def drawnoteb(expr noteheadwidth, noteheadheight, theta_a,
  66.               theta_b, theta_c, width_a, width_b)  =
  67.     penpos1(width_a, theta_a);       %         .l
  68.     penpos3(width_a, 180+theta_a);   %         .2
  69.     penpos2(width_b, 180+theta_b);   %         .r
  70.     penpos4(width_b, theta_b);       %.l.1.r         .r.3.l
  71.     x1l =  y1 = y3 = 0;              %         .r
  72.     x3l = 2x2 = 2x4 = noteheadwidth; %         .4
  73.     y2l =-y4l = noteheadheight;      %         .l
  74.     t:= identity rotatedaround ((x2,0),theta_c);
  75.     penstroke (z1e{up}..z2e{right}..z3e{down}..z4e{left}..cycle)
  76.                transformed t;
  77. %{{{
  78.     currentpen:= pencircle;
  79.     draw (z1{up}..z2{right}..z3{down}..z4{left}..cycle) transformed t
  80. %}}}
  81. enddef;
  82.  
  83. def drawnotew(expr noteheadwidth, noteheadheight, theta_a,
  84.               theta_b, width_a, width_b)  =
  85.     penpos1(width_a, theta_a);       %         .l
  86.     penpos3(width_a, 180+theta_a);   %         .2
  87.     penpos2(width_b, 180+theta_b);   %         .r
  88.     penpos4(width_b, theta_b);       %.l.1.r        .r.3.l
  89.     x1l= y1l  = y3l  = 0;            %         .r
  90.     x3l= 2x2l = 2x4l = noteheadwidth;%         .4
  91.     y2l=-y4l  = noteheadheight;      %         .l
  92.     fill z1l{up}..z2l{right}..z3l{down}..z4l{left}..cycle;
  93.     erase fill z1r{up}..z2r{right}..z3r{down}..z4r{left}..cycle;
  94. %{{{
  95.     currentpen:= pencircle;
  96.     draw z1{up}..z2{right}..z3{down}..z4{left}..cycle;
  97. %}}}
  98.     penlabels(1,2,3,4)
  99. enddef;
  100.  
  101. %%%AE I found in a notebook a whole note which looks slight different
  102. def drawnote_w(expr noteheadwidth, noteheadheight, theta, width_a, width_b)=
  103.     x1= y1 = y3 = y5 = y7 = 0;
  104.     x3= 2x2 = 2x4 = 2x6 = 2x8 = noteheadwidth;
  105.     y2=-y4 = noteheadheight;
  106.     x5= x3-x7 = x1+width_a;
  107.     y6=-y8 = y2-width_b;
  108.     fill z1{curl3}..z2..{curl3}z3{curl3}..z4..{curl3}cycle;
  109.     unfill (z5..z6..z7..z8..cycle) rotatedaround ((x2,0),theta);
  110.     labels(range 1 thru 8);
  111. enddef;
  112. %%%AE if you have GFtoDVI and want to see the character,
  113. %     uncomment the next four lines
  114. %beginchar(0,1.5nhh#, .5nhh#, .5nhh#);
  115. %    drawnote_w(w, h, 45, 1.6thick, .5thin);
  116. %endchar;
  117. %end
  118.  
  119. %%%%%%%%%
  120. % flags %
  121. %%%%%%%%%
  122. %%%AE the penstrike macro is a copy of plain's penstroke
  123. %     macro, 'fill' is replaced by 'filldraw', this is
  124. %     responsible for 'strange path' when sharp turns ahead (intersectionp)
  125. %     the second macro does the same with a little more 'tolerance'
  126. %
  127. %     I don't like it at all, because the flags are thicker
  128. %     on lowres than (or as?) on highres devices
  129. %     {Sorry, my english is very bad, nevertheless I hope you
  130. %      understand my words}
  131. %
  132. %%%def penstrike text t =
  133. %%% forsuffixes e = l,r: path_.e:=t; endfor
  134. %%% if cycle path_.l: cyclestroke_
  135. %%% else: filldraw path_.l -- reverse path_.r -- cycle fi enddef;
  136. %
  137. %def penstrike text t =
  138. % forsuffixes e = l,r: path_.e:=t; endfor
  139. % if cycle path_.l: cyclestroke_
  140. % else: fill path_.l -- reverse path_.r -- cycle;
  141. %       draw path_.l -- reverse path_.r -- cycle fi enddef;
  142.  
  143. def flagshape(suffix i) (expr width, height, thick,
  144.                          thin, shiftx, shifty, flagsense) =
  145.     pair intersectionp;               %  .1
  146.     penpos[i](thick+blacker, 90);     %
  147.     penpos[i+1](3.25thin+blacker, 70);%       .2
  148.     penpos[i+3](thin, -45);           %
  149.     x[i]   = rt shiftx;               %           .3
  150.     y[i]   = height+shifty-thick/2;   %
  151.     x[i+1] = shiftx+3/8width;         %        .4
  152.     y[i+1] = height+shifty-.95thick;  %
  153.     x[i+2] = shiftx+width-thin/2;
  154.     y[i+2] = height+shifty-2thick;
  155.     x[i+3] = shiftx-thin/2+0.6width;
  156.     y[i+3] = shifty;
  157.     if i>1: intersectionp = z[i-2]; else: intersectionp = z[i+3]; fi;
  158.     if flagsense>0:
  159.        penpos[i+2](1.25thin+blacker, 35);
  160.     else:
  161.        penpos[i+2](1.05thin+blacker, 0);
  162.     fi;
  163.     penstroke z[i]e..z[i+1]e..z[i+2]e{down}..intersectionp;
  164. %{{{
  165.     currentpen:= pencircle;
  166.     draw lft z[i]..z[i+1]..z[i+2]{down}..intersectionp;
  167. %}}}
  168.     penlabels (range i thru i+3)
  169. enddef;
  170.  
  171. % Added by D. Taupin Jan 1993
  172. beginchar(14,0.5nhw#,0,0); "Song system limit up";
  173. %%%AE clearxy is already done by 'beginchar();'
  174. %   clear;
  175.     x1=y1=y2=0; 3x2=x3=3w; y3=nhh;
  176.     p:= z1---z2..z3;
  177.     pickup penrazor scaled med rotated 90;
  178.     draw p;
  179. %{{{
  180.     currentpen:= pencircle;
  181.     draw p;
  182. %}}}
  183.     savepic;
  184. endchar;
  185.  
  186. beginchar(15,0.5nhw#,0,0); "Song system limit down";
  187.     callpic;
  188.     mirror (origin, right);
  189. endchar;
  190.  
  191. for n:=1 upto 4:
  192. %<<<>>>(0.5+0.1*n)*nhh#
  193.     beginchar(15+n, 4n*nhw#, 0, (0.5+0.1n)*nhh#); "Crescendo";
  194.         pickup med_pen;
  195.         draw (0,(0.5+0.1n)*nhh)--(w,0)--(0,-d);
  196.     endchar;
  197. endfor;
  198.  
  199. for n:=1 upto 4:
  200. %<<<>>>(0.5+0.1*n)*nhh#
  201.     beginchar(19+n, 4n*nhw#, 0, (0.5+0.1n)*nhh#); "Decrescendo";
  202.         pickup med_pen;
  203.         draw (w,(0.5+0.1n)*nhh)--(0,0)--(w,-d);
  204.     endchar;
  205. endfor;
  206.  
  207. %%%%%%%%%%%
  208. % accents %
  209. %%%%%%%%%%%
  210. dely:=1.15nhh+.2pt;
  211.  
  212. %%%AE 'fill fullcircle' is faster and produce 'nicer' circles
  213. beginchar(24, nhw#, nhh#, 0); "Point au-dessus de la note";
  214.     fill fullcircle scaled thick shifted (.5w, dely);
  215.     savepic;
  216. endchar;
  217.  
  218. beginchar(25, nhw#, 0, nhh#); "Point au-dessous de la note";
  219.     callpic;
  220.     mirror (origin, right);
  221. endchar;
  222.  
  223. beginchar(26, nhw#, nhh#, 0); "Barre au-dessus de la note";
  224. %%%AE faster
  225.     fill unitsquare xscaled w yscaled 1.25med shifted (0,dely-.625med);
  226.     savepic;
  227. endchar;
  228.  
  229. beginchar(27, nhw#, 0, nhh#); "Trait au-dessous de la note";
  230.     callpic;
  231.     mirror (origin, right);
  232. endchar;
  233.  
  234. beginchar(28, nhw#, nhh#, 0); "Accent (pizz.) au-dessus de la note";
  235.     rayon:= thin+.1nhh;
  236.     z1=(0.5w,w+rayon);
  237.     z2=(0.5w-rayon,w);
  238.     z3=(0.5w,w-0.45nhh);
  239.     z4=(0.5w+rayon,w);
  240.     fill z3--z4{up}..z1..{down}z2--cycle;
  241.     savepic;
  242. endchar;
  243.  
  244. beginchar(29, nhw#, 0, nhh#); "Accent (pizz.) au-dessous de la note";
  245.     callpic;
  246.     mirror (origin, right);
  247. endchar;
  248.  
  249. %%%AE why 1.5nhh ???
  250. beginchar(30, nhw#, 1.5nhh#, 0); "Accent (sforz.) au-dessus de la note";
  251.     pickup med_pen;
  252.     draw (-.2w, 1.6nhh)--(1.2w, 1.3nhh)--(-.2w, nhh);
  253.     savepic;
  254. endchar;
  255.  
  256. beginchar(31, nhw#, 0, nhh#); "Accent (sforz.) au-dessous de la note";
  257.     callpic;
  258.     mirror (origin, right);
  259. endchar;
  260.  
  261. %%%%%%%%%
  262. % breve %
  263. %%%%%%%%%
  264. def breve =
  265.     fill unitsquare xscaled w yscaled .5h shifted (0,.25h);
  266.     add_mirror (origin, right);
  267.     nh:= .7nhh;
  268.     pickup thin_pen;
  269.     draw (0,nh)--(0,-nh); draw (w,nh)--(w,-nh);
  270. enddef;
  271.  
  272. %<<<>>>.7nhh#
  273. beginchar(32, nhw#, 0.5nhh#, 0.5nhh#); "Breve";
  274.     breve;
  275. endchar;
  276.  
  277. beginchar(33, nhw#, .5nhh#, .5nhh#); "Quarter note";
  278.     w:=w+2thinwidth;
  279. %%%AE a little bit smaller, because a quarter note
  280. %     seems to be thicker as an half note
  281.     drawnoteb(w, .99h, 0, 90, 20, w/2, h);
  282. endchar;
  283.  
  284. beginchar(34, nhw#, .5nhh#, .5nhh#); "Half note";
  285.     w:=w+2thinwidth;
  286.     drawnoteb(w, h, 0, 90, 20, thin, thick);
  287. endchar;
  288.  
  289. beginchar(35,1.5nhh#, .5nhh#, .5nhh#); "Whole note";
  290.     drawnotew(w, h, 0, 30, 1.3thick, 1.75thin);
  291. endchar;
  292.  
  293. %<<<>>>.7nhh#
  294. beginchar(36, 2nhw#, 0.5nhh#, 0.5nhh#); "Semi-breve";
  295.     breve;
  296. endchar;
  297.  
  298. beginchar(37, apog_nhw#, .5apog_nhh#, .5apog_nhh#); "Small quarter note";
  299.     w:=w+2thinwidth;
  300.     drawnoteb(w, .99h, 0, 90, 20, w/2, h);
  301. endchar;
  302.  
  303. beginchar(38, apog_nhw#, .5apog_nhh#, .5apog_nhh#); "Small half note";
  304.     w:=w+2thinwidth;
  305.     drawnoteb(w, h, 0, 90, 20, thin, apog_fact*thick);
  306. endchar;
  307.  
  308. beginchar(39, 1.5apog_nhh#, .5apog_nhh#, .5apog_nhh#); "Small full note";
  309.     drawnotew(w, h, 0, 30, apog_fact*1.3thick, 1.5thin);
  310. endchar;
  311.  
  312. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  313. % general parameters for flags %
  314. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  315. flagw:=0.8nhw;
  316. flagthick:=nhh;
  317. flagthin:=5thinwidth;
  318.  
  319. def cflag (expr sense) =
  320.     flagshape(1, flagw, h, flagthick, flagthin, 0, 0, sense);
  321.     if sense<0 : mirror ((0,h/2), (1,h/2)); fi
  322. enddef;
  323.  
  324. def flagloop (expr sense, doitagain) =
  325.     flagshape(1, flagw, 2.50flagthick, 2/3flagthick,
  326.               flagthin, 0, 0, sense);
  327.     for xyz:=1 upto doitagain:
  328.         flagshape([4xyz+1], flagw, 2.25flagthick, 2/3flagthick,
  329.                   flagthin, 0, (.75xyz+.25)*flagthick, sense);
  330.     endfor;
  331.     if sense<0 : mirror ((0,h/2), (1,h/2)); fi
  332. enddef;
  333.  
  334. def ccflag (expr sense) = flagloop(sense, 1) enddef;
  335. def cccflag (expr sense) = flagloop(sense, 2) enddef;
  336. def ccccflag (expr sense) = flagloop(sense, 3) enddef;
  337. def cccccflag (expr sense) = flagloop(sense, 4) enddef;
  338.  
  339. beginchar(40, 0, 3nhh#, 0); "1/8flag down";
  340.     cflag(1);
  341.     savepic;
  342. endchar;
  343.  
  344. % Acciacaturra, added by D.Taupin Jan 93.
  345. % idem mais avec barre (appogiature)
  346. beginchar(12, 0, 3nhh#, 0); "Acciacaturra stem up";
  347.     callpic;
  348.     pickup med_pen;
  349.     x1=-0.25nhw; y1=0.2h; x2=1.1nhw; y2=y1+0.6(x2-x1);
  350.     draw z1--z2;
  351. endchar;
  352.  
  353. beginchar(41, 0, 3.25nhh#, 0); "1/16flag down";
  354.     ccflag(1);
  355. endchar;
  356.  
  357. beginchar(42, 0, 4.00nhh#, 0); "1/32flag down";
  358.     cccflag(1);
  359. endchar;
  360.  
  361. beginchar(43, 0, 4.75nhh#, 0); "1/64flag down";
  362.     ccccflag(1);
  363. endchar;
  364.  
  365. beginchar(44, 0, 5.50nhh#, 0); "1/128flag down";
  366.     cccccflag(1);
  367. endchar;
  368.  
  369. %%%
  370. % flags up should be wider
  371. %%%
  372. flagw:=nhw;
  373.  
  374. beginchar(45, 0, 3nhh#, 0); "1/8flag up";
  375.     cflag(-1);
  376.     savepic;
  377. endchar;
  378.  
  379. % added by D.Taupin Jan 93.
  380. % idem mais avec barre (appogiature)
  381. beginchar(13, 0, 3nhh#, 0); "Acciacaturra stem down";
  382.     callpic;
  383.     pickup med_pen;
  384.     x1=-0.25nhw; y1=1.6nhh; x2=1.2nhw; y2=y1+0.6(x2-x1);
  385.     draw z1--z2;
  386. endchar;
  387.  
  388. beginchar(46, 0, 3.25nhh#, 0); "1/16flag up";
  389.     ccflag(-1);
  390. endchar;
  391.  
  392. beginchar(47, 0, 4.00nhh#, 0); "1/32flag up";
  393.     cccflag(-1);
  394. endchar;
  395.  
  396. beginchar(48, 0, 4.75nhh#, 0); "1/64flag up";
  397.     ccccflag(-1);
  398. endchar;
  399.  
  400. beginchar(49, 0, 5.50nhh#, 0); "1/128flag up";
  401.     cccccflag(-1);
  402. endchar;
  403.  
  404. %%%%%%%%%%%%%%%
  405. % accidentals %
  406. %%%%%%%%%%%%%%%
  407. def flat (expr reduction, shiftx, flatsense) =
  408.     clear;
  409.     fthick:= reduction*s;
  410.     penpos4(4/3fthick+blacker,0);  % 1
  411.     penpos3(1/2fthick+blacker,-90);%
  412.     penpos6(4/7fthick+blacker,90); %   6
  413.     penpos2(.1thinwidth, 180);     %  / \
  414.     x1 = x2 = x3 = x5 = fthick;    % 2   4
  415.     y1 = 6fthick; y2l= 0.5y4;      %    /
  416.     y3l=-2fthick; y5= y3r;         % 3,5
  417.     x4 = 3.6fthick; y4 = 0.1fthick;
  418.     y6r= 2fthick; x6= 0.5(x2+x4);
  419.     t:=identity shifted (shiftx,0);
  420.     p:= (z1--z5) transformed t;
  421.     pickup penrazor scaled (2sind40*thin) rotated 40;
  422.     draw p;
  423. %{{{
  424.     currentpen:= pencircle;
  425.     draw p;
  426. %}}}
  427.     penstroke (z2e..{right}z6e..z4e{sw+down}..{sw}z3e) transformed t;
  428.     if flatsense<0: mirror (z5 transformed t, z1 transformed t); fi;
  429.     penlabels (1,2,3,4,5,6)
  430. enddef;
  431.  
  432. %<<<>>> 2nhh#
  433. beginchar(50, nhw#, 1.5nhh#, 1.5nhh#); "Flat";
  434.     flat (1, 0, 1);
  435.     savepic;
  436. endchar;
  437.  
  438. %<<<>>> 2nhh#
  439. beginchar(51,1.7nhw#, 1.5nhh#, 1.5nhh#); "Doubleflat";
  440.     callpic;
  441.     addto currentpicture also currentpicture shifted (.7nhw, 0);
  442. endchar;
  443.  
  444. def sharp =
  445.     clear;
  446.     reduction:=w/0.8nhw;
  447.     sthick:= .5reduction*thick;
  448.     y1 =-y7= h-1.5sthick; y2 =-y8 = .5sthick-h;
  449.     x1 = x2 = y3 = -y6 = w-x7 = w-x8 = 2sthick;
  450.     y4 =-y5 = y3 + 3sthick;
  451.     x3 = x5 = 0; x4 = x6 = w;
  452.     pickup penrazor scaled thin rotated angle(z4-z3);
  453.     draw z1--z2; draw z8--z7;
  454. %{{{
  455.     currentpen:= pencircle;
  456.     draw z1--z2; draw z8--z7;
  457. %}}}
  458.     pickup penrazor scaled 3sthick rotated 90;
  459.     draw z3--z4; draw z5--z6;
  460.     labels (range 1 thru 8)
  461. enddef;
  462.  
  463. beginchar(52, 0.8nhw#, 1.5nhh#, 1.5nhh#); "Sharp";
  464.     sharp;
  465. endchar;
  466.  
  467. def doublesharp (expr high)=
  468.     clear;
  469.     x4= .5w; y4=high;
  470.     x1=w-x7=.5w+1/25nhh; y1=y7=0;
  471.     x2=w-x6=.51w+thin; y2=y6=.3y4;
  472.     x3=w-x5=.58w+thin; y3=y5=.6y4;
  473.     t:= identity rotatedaround ((.5w, 0), 90);
  474.     fill (z1{up}..z2..z3..{nw}z4 & z4{sw}..z5..z6..{down}z7--z1--cycle)
  475.           rotatedaround ((.5w, 0), 45);
  476.     addto currentpicture also currentpicture transformed t;
  477.     addto currentpicture also currentpicture transformed (t transformed t);
  478.     labels (1,2,3,4,5,6,7)
  479. enddef;
  480.  
  481. %<<<>>>.5nhw#
  482. beginchar(53, nhw#, nhh#, nhh#); "Doublesharp";
  483.     doublesharp (.65w);
  484. endchar;
  485.  
  486. def natural =
  487.     clear;
  488.     reduction:=w/0.8nhw;
  489.     nthick:= 3/4reduction*thick;
  490.     x1 = x2 = x3 = nthick;
  491.     x5 = x6 = x4 = w-x1;
  492.     y1 = -y6 = h;
  493.     y2 = -y5 = 1.6nthick;
  494.     y4 = -y3 = y2+4/3nthick;
  495.     pickup penrazor scaled thin rotated angle(z4-z2);
  496.     draw lft z1--bot lft(x3,y3-nthick);
  497.     draw top rt(x4,y4+nthick)--rt z6;
  498. %{{{
  499.     pickup pencircle;
  500.     draw lft z1--lft(x3,y3-nthick);
  501.     draw rt(x4,y4+nthick)--rt z6;
  502. %}}}
  503.     pickup penrazor scaled 2nthick rotated 90;
  504.     draw z2--z4; draw z3--z5;
  505.     labels(1,2,3,4,5,6)
  506. enddef;
  507.  
  508. beginchar(54, 0.8nhw#, 1.5nhh#, 1.5nhh#); "Natural";
  509.     natural;
  510. endchar;
  511.  
  512. %<<<>>> 2nhh#
  513. beginchar(55, nhw#, 1.5nhh#, 1.5nhh#); "1/4 flat";
  514.     flat (1, 0.65nhw, -1);
  515. endchar;
  516.  
  517. %<<<>>> 2nhh#
  518. beginchar(56, 1.7nhw#, 1.5nhh#, 1.5nhh#); "3/4 flat";
  519.     flat (1, 0.65nhw, -1); flat (1, 0.65nhw, 1);
  520. endchar;
  521.  
  522. beginchar(57, nhw#, .5nhh#, .5nhh#); "Gregorian notes";
  523.     fill (0.5w-0.8h,0)--(0.5w,h)--(0.5w+0.8h,0)--(0.5w,-h)--cycle;
  524. endchar;
  525.  
  526. beginchar(0, nhw#, .5nhh#, .5nhh#); "Gregorian diamond";
  527.     fill (0,0)--(0.5w,0.5nhw)--(w,0)--(0.5w,-0.5nhw)--cycle;
  528. endchar;
  529.  
  530. beginchar(1, 0.71*nhw#, .5nhh#, .5nhh#); "Gregorian square";
  531.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  532. endchar;
  533.  
  534. beginchar(2, 0.71*nhw#, .5nhh#, .5*nhh#); "Gregorian square left";
  535.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  536.     pickup thin_pen;
  537.     draw (0.5thin,0.355nhw-thin)--(0.5thin,-1.5nhh+0.5thin);
  538. endchar;
  539.  
  540. beginchar(3, 0.71*nhw#, .5nhh#, .5nhh#); "Gregorian square right";
  541.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  542.     pickup thin_pen;
  543.     draw (w-0.5thin,0.355nhw-thin)--(w-0.5thin,-1.5nhh+0.5thin);
  544. endchar;
  545.  
  546. beginchar(4, nhw#, 3nhh#, 0); "Gregorian C clef";
  547.     fill (0,2nhh+0.8nhh)..{right}(0.5w,2nhh+nhh)--(w,2nhh+nhh)--
  548.       (w,2nhh+0.3nhh)--(0.5w,2nhh+0.3nhh){left}..(0,2nhh+0.1nhh)--cycle;
  549.     fill (0,2nhh-0.8nhh)..{right}(0.5w,2nhh-nhh)--(w,2nhh-nhh)--
  550.       (w,2nhh-0.3nhh)--(0.5w,2nhh-0.3nhh){left}..(0,2nhh-0.1nhh)--cycle;
  551.     pickup thin_pen;
  552.     draw (0.5thin,2.5nhh)--(0.5thin,1.5nhh);
  553. endchar;
  554.  
  555. %%%%%%%%%
  556. % rests %
  557. %%%%%%%%%
  558. beginchar(58,1/2nhw#, 3nhh#, 0); "Dp";
  559.     fill unitsquare xscaled w yscaled 1/3h shifted (0, 2/3h);
  560. endchar;
  561.  
  562. beginchar(59,1/2nhw#, 3nhh#, 0); "Ddp";
  563.     fill unitsquare xscaled w yscaled 2/3h shifted (0, 1/3h);
  564. endchar;
  565.  
  566. beginchar(60, nhw#, 3nhh#, 0); "Full rest";
  567.     fill unitsquare xscaled w yscaled .5nhh shifted (0,h-.5nhh);
  568. endchar;
  569.  
  570. %<<<>>> 2.5nhh#
  571. beginchar(61, nhw#, 3nhh#, 0); "Half rest";
  572.     fill unitsquare xscaled w yscaled .5nhh shifted (0,h-nhh);
  573. endchar;
  574.  
  575. beginchar(62, nhw#, 4nhh#, 0); "Quarter rest";
  576.     rthin:= 1/8 nhh;           % .1
  577.     rthick:= 2 thick+rthin;    %       .2
  578.     alpha:= -50;               %    .3
  579.     penpos1 (rthin, 90+alpha); % .4
  580.     penpos5 (rthin, alpha);    %       .5,10
  581.     penpos2 (rthick, alpha);   %   .6
  582.     penpos4 (rthick, alpha);   %
  583.     penpos3 (3/4rthick, alpha);%       .7
  584.     penpos6 (4/3thick, alpha);
  585.     penpos7 (rthin, 45);
  586.     y1l = h - 2s;
  587.     x1l = 2s;
  588.     z2r = z1 +(nhh* right) rotated alpha;
  589.     z3  = 1/2[z2,z4];
  590.     z4  = (w,h) scaled .55;
  591.     z5  = z4l+(nhh* right) rotated alpha;
  592.     x6l = x4l; y6r = 1.45nhh;
  593.     x7  = 0.9w; y7= nhh-.5s;
  594.     z10 = z5r shifted (sqrt(2)*rthin/4,sqrt(2)*rthin/4);
  595.  
  596.     pickup penrazor scaled rthin rotated 45;
  597.     draw z1--z2r; draw z4l--z10;
  598.     penstroke z2e..z3e..z4e;
  599.     penstroke z5e..z6e..z7e;
  600.     penlabels(1,2,3,4,5,6,7,10);
  601. endchar;
  602.  
  603. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  604. % Quaver rest and submultiples. %
  605. % Ross Mitchell,  January 1993  %
  606. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  607. %%%
  608. %   Draw the crook needed for quaver rests and shorter.
  609. %   The crook extends left from the point z.i on the stem.
  610. %%%
  611. def crook(suffix i)=
  612.     x3:=x.i-6.5fact; y3:=top y.i-3.0fact;
  613.     x4:=x.i-6.0fact; y4:=    y.i+0.5fact;
  614.     draw z.i{dir 240}..{dir 160}z3;
  615.     filldraw z3{dir 160}..z4{dir-20}..{dir 160}z3..cycle
  616. enddef;
  617.  
  618. beginchar(63, 2nhh#, 3nhh#, 0); "Quaver rest";
  619.     z1=(nhh,nhh);
  620.     z2-z1=whatever*dir 70;    %  Angle the stem at 70 degrees.
  621. %%%
  622. %   Define the scaling factor `fact' implicitly.
  623. %   This value will be used for the shorter rests as well.
  624. %%%
  625.     z2-z1=(5fact,1.7nhh);
  626.     pickup med_pen;
  627.     draw z1..z2;
  628.     crook(2);
  629.     penlabels (1,2,3,4);
  630. endchar;
  631.  
  632. beginchar(64,2nhh#, 3nhh#, 0); "Semiquaver rest";
  633.     z1=(nhh,0);
  634.     z2-z1=whatever*dir 75;    %  Angle the stem at 75 degrees.
  635.     y2-y1=2.7nhh;
  636.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  637.     pickup med_pen;
  638.     draw z1..z2;
  639.     crook(2); crook(5);
  640.     penlabels (1,2,3,4,5);
  641. endchar;
  642.  
  643. beginchar(65,2nhh#, 4nhh#, 0); "Demisemiquaver rest";
  644.     z1=(nhh,0);
  645.     z2-z1=whatever*dir 80;    %  Angle the stem at 80 degrees.
  646.     y2-y1=3.7nhh;
  647.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  648.     z6-z2=whatever*(z1-z2); y6=y5-nhh;
  649.     pickup med_pen;
  650.     draw z1..z2;
  651.     crook(2); crook(5); crook(6);
  652.     penlabels (1,2,3,4,5,6);
  653. endchar;
  654.  
  655. %<<<>>> 5nhh#
  656. beginchar(66,2nhh#, 4.75nhh#, 0); "Hemidemisemiquaver rest";
  657.     z1=(nhh,0);
  658.     z2-z1=whatever*dir 82;    %  Angle the stem at 82 degrees.
  659.     y2-y1=4.7nhh;
  660.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  661.     z6-z2=whatever*(z1-z2); y6=y5-nhh;
  662.     z7-z2=whatever*(z1-z2); y7=y6-nhh;
  663.     pickup med_pen;
  664.     draw z1..z2;
  665.     crook(2); crook(5); crook(6); crook(7);
  666.     penlabels (1,2,3,4,5,6,7);
  667. endchar;
  668.  
  669. %%%%%%%%%%%%%
  670. % ornaments %
  671. %%%%%%%%%%%%%
  672. beginchar (67, 2nhw#, nhh#, 0); "Ornament";
  673.     x1=w-x6=0.2w; y1r=h; y6=h-y1;
  674.     x2r=0; y2=0.5h; x5=w-x2; y5=h-y2;
  675.     x3=0.22w; y3r=0; x4=w-x3; y4=h-y3;
  676.     penpos1 (med, 90);
  677.     penpos2 (med, 180);
  678.     penpos3 (thick,-40);
  679.     penpos4 (thick,-40);
  680.     penpos5 (med, 180);
  681.     penpos6 (med, 90);
  682.     penstroke z1e..{down}z2e{down}..{right}z3e{right}
  683.               ..{right}z4e{right}..{down}z5e{down}..z6e;
  684.     fill fullcircle scaled (s+thick) shifted (x1,y1r-thick);
  685.     fill fullcircle scaled (s+thick) shifted (x6,y6l+thick);
  686.     penlabels(1,2,3,4,5,6);
  687.     savepic;
  688. endchar;
  689.  
  690. beginchar (68, 2nhw#, nhh#, 0); "Ornament";
  691.     callpic;
  692.     mirror ((.5w,0), (.5w,1));
  693. endchar;
  694.  
  695. %<<<>>>3.5apog_nhh#
  696. beginchar(69, apog_nhw#, 3.25apog_nhh#, .5apog_nhh#); "Appogiature stem up";
  697.     flagshape(1,0.8w, 3apog_nhh, apog_nhh, 4thinwidth, w, 0.5apog_nhh, 1);
  698.     clear;
  699.     drawnoteb(w, 0.5apog_nhh, 0, 90, 20, w/2, apog_nhh/2);
  700.     clear;
  701.     pickup pencircle scaled .8med;
  702.     draw (w-2thinwidth,0)--(w-2thinwidth,3.5apog_nhh);
  703.     x1=-0.1w; y1=0.6apog_nhh; x2=2w; y2=y1+0.6(x2-x1);
  704.     draw z1--z2;
  705. endchar;
  706.  
  707. beginchar(70, apog_nhw#, 0.5apog_nhh#, 3.5apog_nhh#); "Appogiature stem down";
  708.     flagshape(1,w, 3apog_nhh, apog_nhh, 4thinwidth, 0.2pt, apog_nhh, -1);
  709.     mirror ((0,h/2), (1,h/2));
  710.     clear;
  711.     drawnoteb(w, 0.5apog_nhh, 0, 90, 20, w/2, apog_nhh/2);
  712.     pickup pencircle scaled .8med;
  713.     draw (2thinwidth,0)--(2thinwidth,-d);
  714.     clear;
  715.     x1=-0.3w; y1=-1.6apog_nhh; x2=1.3w; y2=y1+0.6(x2-x1);
  716.     draw z1--z2;
  717. endchar;
  718.  
  719. %%%%%%%%%
  720. % clefs %
  721. %%%%%%%%%
  722. def violin(expr reduction) =
  723.     clear;
  724.     gx:=reduction*-nhw;
  725.     gy:=reduction*nhh;
  726.     gthick:=1.6reduction*thick;
  727.     gthin:=.95reduction*med;
  728.  
  729.     x1=x4=23/24gx+w;  x2=x10=3/4gx+w;  x3r=w; x8l=7/8gx+w;
  730.     x5=x11r=2gx+w;  x6=gx+w;  x7=1/2gx+w;  x9=5/4gx+w;
  731.     y1=3/8gy;  y2=y5=2gy;  y3=gy;  y4r=0;  y6=27/8gy;
  732.     y7l=21/4gy;  y8l=23/4gy;  y9=17/4gy;  y10=y11=-7/8gy;
  733.     penpos1(gthin,180);
  734.     penpos2(gthick,90);
  735.     penpos3(gthick,0);
  736.     penpos4(5/4gthin,-90);
  737.     penpos5(11/8gthick,110);
  738.     penpos6(5/4gthick,120);
  739.     penpos7(4/5gthin,-140);
  740.     penpos8(5/4gthick,-80);
  741.     penpos9(3/8gthick,0);
  742.     penpos10(gthin,0);
  743.     penpos11(1/2gthick,180);
  744.     penstroke z1e{left}..z2e..z3e..z4e..z5e{up+ne}..z6e..{up+nw}z7e
  745.               ..z8e{sw}..{down}z9e{down}..{down}z10e..z11e;
  746. %{{{
  747.     currentpen:= pencircle;
  748.     draw z3..z4..z5{up+ne}..z6..{up+nw}z7
  749.          ..z8{sw}..{down}z9{down}..{down}z10..z11;
  750. %}}}
  751.     fill fullcircle scaled (3(x2-x1)) shifted (x11+11/40gy, y11);
  752.     penlabels(range 1 thru 11)
  753. enddef;
  754.  
  755. %<<<>>> 6nhh#
  756. beginchar(71,3.25nhw#, 5.50nhh#, 2nhh#); "G-clef";
  757.     violin(1);
  758. endchar;
  759.  
  760. %<<<>>> 6nhh#
  761. beginchar(72,2.60nhw#, 5.50nhh#, 2nhh#); "small G-clef";
  762.     violin(0.8);
  763. endchar;
  764.  
  765. % clef de fa par D. Taupin
  766. def bass (expr reduction) =
  767.     clear;
  768.     x2=0.80reduction*nhw; y2=3nhh;
  769.     x1=x2r+1.25reduction*s; y1=y2;
  770.     x3=x2+0.71reduction*nhw; y3=y2+reduction*nhh;
  771.     x4=x3+0.71reduction*nhw; y4=y2-0.2reduction*nhh;
  772.     x6=x2-6reduction*thinwidth; y6=y2-2.2reduction*nhh;
  773.     x7=x4+0.50reduction*nhw; x8=x7;
  774.     y7=y2+0.38reduction*nhh; y8=y2-0.38reduction*nhh;
  775.  
  776.     penpos2(.6thick*reduction,180);
  777.     penpos3(.6thick*reduction, 90);
  778.     penpos4(2thick*reduction,0);
  779.     penpos6(.4thick*reduction,-10);
  780.  
  781.     penstroke(z2e{up}..{right}z3e{right}..{down}z4e{down}
  782.               ..{left+0.1down}z6e);
  783. %{{{
  784.     currentpen:= pencircle;
  785.     draw (z2{up}..{right}z3{right}..{down}z4{down}..{left+0.1down}z6);
  786. %}}}
  787.     fill fullcircle scaled (2(x2r-x1)) shifted z1;
  788.     fill fullcircle scaled 1.7s shifted z7;
  789.     fill fullcircle scaled 1.7s shifted z8;
  790.     penlabels(1,2,3,4,6)
  791. enddef;
  792.  
  793. beginchar(73, 3nhw#, 4nhh#, 0); "F-clef";
  794.     bass(1.0);
  795. endchar;
  796.  
  797. beginchar(74, 2.4nhw#, 4nhh#, 0); "small F-clef";
  798.     bass(0.8);
  799. endchar;
  800.  
  801. def alt(expr reduction, yshift) =
  802.     clear;
  803.     nh:=h*reduction;
  804.     athick:=1/10nh;
  805.     ahigh:=1/2nh;
  806.  
  807.     x4=13/16nh+3thinwidth; x5=9/16nh;
  808.     x6=1/2nh; x9=x10=2/3nh; x11=17/32nh;
  809.     y4=yshift+31/50ahigh; y5=yshift+1/2ahigh;
  810.     y6=yshift; y9=yshift+1/9ahigh;
  811.     y10=yshift+ahigh; y11=yshift+11/14ahigh;
  812.     penpos4(athick,180);
  813.     penpos5(1/8athick,0);
  814.     penpos6(athick,0);
  815.     penpos9(1/3athick,90);
  816.     penpos10(1/3athick,-90);
  817.     penpos11(1/2athick,0);
  818.  
  819.     penstroke z5e..{sw+down}z6e;
  820.     penstroke z5e{se+3down}..{right}z9e{right}..{up}z4e{up}
  821.               ..{left}z10e{left}..{sw+3down}z11e;
  822.     fill fullcircle scaled (5/2thick*reduction)
  823.                     shifted (x11l+5/4thick*reduction, y11-.05nhh);
  824.     fill unitsquare xscaled athick yscaled ahigh
  825.                     shifted (5/16nh-1/2athick,yshift);
  826.     fill unitsquare xscaled 1/4athick yscaled ahigh
  827.                     shifted (x6l-1/4athick,yshift);
  828.     add_mirror ((0,yshift),(1,yshift));
  829.     penlabels(4,5,6,9,10,11)
  830. enddef;
  831.  
  832. beginchar(75,3.5nhw#, 4nhh#, 0); "Alto clef";
  833.     alt(1, 2nhh);
  834.     savepic;
  835. endchar;
  836.  
  837. beginchar(76,2.8nhw#, 4nhh#, 0); "small Alto clef";
  838.     alt(0.8 ,2nhh);
  839. endchar;
  840.  
  841. %%%%%%%%%%%%%
  842. % drum clef % (by Andreas Egler)
  843. %%%%%%%%%%%%%
  844. beginchar(77, 3nhw#, 4nhh#, 0);
  845.     fill unitsquare xscaled .5nhw yscaled 2nhh shifted (.5nhw,1nhh);
  846.     fill unitsquare xscaled .5nhw yscaled 2nhh shifted (1.5nhw,1nhh);
  847. endchar;
  848.  
  849. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  850. % this sign is sometimes used      %
  851. % to indicate a (randomly played)  %
  852. % tremolo accord (ragtime, boogie) %
  853. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  854. beginchar(78, 0, 3nhh#, 0);
  855.     clear;
  856.     x1=-x2=-.5nhw; y1=1nhh; y2=1.6nhh;
  857.     pickup med_pen;
  858.     for i=0 upto 4: draw (z1--z2) shifted (0,.4nhh*i); endfor;
  859.     labels (1,2);
  860. endchar;
  861.  
  862.  
  863. %%%%%%%%%%
  864. % shaker %
  865. %%%%%%%%%%
  866. beginchar(79, nhw#, nhh#, nhh#);
  867.     x1=x4=y2=y4=0; y1=-0.6nhh; x2=x3=w; y3=0.6nhh;
  868.     fill z1--z2--z3--z4--cycle;
  869.     labels (1,2,3,4);
  870. endchar;
  871.  
  872.  
  873. %%%%%%%%%%%%%%%%%
  874. % special signs %
  875. %%%%%%%%%%%%%%%%%
  876. %<<<>>>1.25nhh#
  877. beginchar(80, 2nhw#, 1.5*apog_nhh#, 0); "Fermate up";
  878.     x1 = y1 = y3 = 0;
  879.     y2r = 1.5nhh; 2x2l = x3 = w;
  880.     penpos1(med,180);
  881.     penpos2(1.3thick,90);
  882.     penpos3(med,0);
  883.     penstroke z1e..z2e..z3e;
  884.     fill fullcircle scaled 1.3thick shifted (.5w, .65thick);
  885.     savepic;
  886.     penlabels(1,2,3);
  887. endchar;
  888.  
  889. beginchar(81, 2nhw#, 0, 1.25nhh#); "Fermate down";
  890.     callpic;
  891.     mirror (origin, right);
  892. endchar;
  893.  
  894. beginchar(82, 2nhh#, 3nhh#, 0); "Allabreve";
  895.     2x2 = 2x4 = x1 + 2s = w;
  896.     x3r = 0; 2y1 = 3y2 = y4r = h;
  897.     y3r = 2/3h; x5 = w -2s; y5 = h -2s;
  898.     z6r = z5r + (-0.1s, .2s);
  899.     penpos1(med, 0);
  900.     penpos2(med, -90);
  901.     penpos3(s+thick,180);
  902.     penpos4(med, 90);
  903.     penpos5(med, 0);
  904.     penpos6(s+med,45);
  905.     penstroke z1e..z2e..z3e..z4e..z5e;
  906. %{{{
  907.     currentpen:= pencircle;
  908.     draw z1..z2..z3..z4..z5;
  909. %}}}
  910.     fill fullcircle scaled 1.3thick shifted z6;
  911.     savepic;
  912.  
  913.     pickup med_pen;
  914.     draw (w/2, y2r-1/8h)--(w/2, y4r+1/8h);
  915.     penlabels(1,2,3,4,5,6);
  916. endchar;
  917.  
  918. beginchar(83, 2nhh#, 3nhh#, 0); "C";
  919.     callpic;
  920. endchar;
  921.  
  922. beginchar(84, 2nhh#, 3nhh#, 0); "reverseC";
  923.     callpic;
  924.     mirror ((w/2,0),(w/2,1));
  925. endchar;
  926.  
  927. %%%%%%%%%%%%%%%%%%
  928. % repeat symbols %
  929. %%%%%%%%%%%%%%%%%%
  930. beginchar(85, 2nhw#, 3nhh#, 0); "Repeat symbol";
  931.     x2 = w-x4 = 1/6h; y2 = y4 = 1/2h;
  932.     x3 = x5 = 1/2w; y3 = h-y5 = 5/6h;
  933.     pickup pencircle scaled 1.25thin;
  934.     draw (0,h/2)--(w,h/2); draw (w/2,0)--(w/2,h);
  935.     pickup pencircle xscaled 1.2thick yscaled 1.25thin;
  936.     draw z2..z3..z4..z5..cycle;
  937.     labels (1,2,3,4);
  938. endchar;
  939.  
  940. %<<<>>>3nhw#
  941. beginchar(86, 3nhw#, 4.75apog_nhh#, 0); "Repeat symbol";
  942.     x6 = .75w;  y6 = .9w; x8 = .4w; y8l = .95w;
  943.     x11= y11 = .5w; z10 = z11+(-s,s);
  944.     penpos8 (med, -90);
  945.     penpos10 (1.8thick, 25);
  946.     penpos11 (1.8thick, 25);
  947.     penstroke z8e{left}..{se}z10e..z11e;
  948.     fill fullcircle scaled 1.6thick shifted (z8l-(0, .8thick));
  949.     fill fullcircle scaled thick shifted (.2w, .4w);
  950.     pickup penrazor scaled 0.8thick;
  951.     draw z6--z11;
  952.     addto currentpicture also currentpicture rotatedaround((.5w,.5w),180);
  953.     penlabels (8,9,11);
  954. endchar;
  955.  
  956. def pince (expr length)=
  957.     clear;
  958.     off:= w/2length;
  959.     nh:= .8nhh;
  960.     y1 = y3 = nh-y2 = nh-y4 = 1/5nh;
  961.     x1=-.5off; x2=x1+off; x3=x2+off; x4=x3+off;
  962.     pickup pensquare xscaled (thick+.15nhh) yscaled thin rotated 52;
  963.     p:= z1--z2--z3--z4;
  964.     for i=1 upto length: draw p shifted ((i-1)*2off,0); endfor
  965. enddef;
  966. %%%%%%%%%% Begin Andreas Egler's
  967. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  968. % full rest outside a staff %
  969. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  970. beginchar(5, nhw#, nhh#, 0);
  971.     fill unitsquare xscaled w yscaled .5nhh shifted (0,-.5nhh);
  972.     fill unitsquare xscaled 1.8w yscaled med shifted (-.4w,-0.5med);
  973. endchar;
  974.  
  975. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  976. % half rest outside a staff %
  977. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  978. beginchar(6, nhw#, nhh#, 0);
  979.     fill unitsquare xscaled w yscaled .5nhh;
  980.     fill unitsquare xscaled 1.8w yscaled med shifted (-.4w,-0.5med);
  981. endchar;
  982. %%%%%%%%%%%%%%%%%%%%%
  983. % mordant with line %
  984. %%%%%%%%%%%%%%%%%%%%%
  985. beginchar(7, 1.8nhw#, apog_nhh#, 0);
  986.     pince(3);
  987.     pickup med_pen;
  988.     draw ((x1,0)--(x1,2h)) shifted (-.5thick,0);
  989. endchar;
  990.  
  991. %%%%%%%%%%%%%%%%%%%%%%%%
  992. % mordant with hook ne %
  993. %%%%%%%%%%%%%%%%%%%%%%%%
  994. beginchar(9, 1.8nhw#, apog_nhh#, 0);
  995.     pince(3);
  996.     pickup pencircle scaled .75med;
  997.     z5=2[z3,z4]-(.5thick,1/5nh); z6=z3 rotatedaround (z5,-90);
  998.     draw (z4..z5{z4-z3}..{z3-z4}z6) shifted 2(x4-x2,0);
  999. endchar;
  1000.  
  1001. %%%%%%%%%%%%%%%%%%%%%%%%
  1002. % mordant with hook nw %
  1003. %%%%%%%%%%%%%%%%%%%%%%%%
  1004. beginchar(10, 1.8nhw#, apog_nhh#, 0);
  1005.     pince(3);
  1006.     pickup pencircle scaled .75med;
  1007.     z5=1.75[z3,z2]-(x3-x1,0); z6=z1 rotatedaround (z5,90);
  1008.     draw (z1..z5{z2-z3}..{z3-z2}z6) shifted -(.5thick, 1/5nh);
  1009. endchar;
  1010.  
  1011. %%%%%%%%%%%%%%%%%%%%%%%%
  1012. % mordant with hook sw %
  1013. %%%%%%%%%%%%%%%%%%%%%%%%
  1014. beginchar(11, 1.8nhw#, apog_nhh#, 0);
  1015.     pince(3);
  1016.     pickup pencircle scaled .75med;
  1017.     z5=1.5[z2,z1]-.75(.5thick,1/5nh); z6=z2 rotatedaround (z5,-90);
  1018.     draw (z1..z5{z1-z2}..{z2-z1}z6);
  1019. endchar;
  1020. %%%%%%%%%% End Andreas Egler
  1021. %<<<>>> .8nhh#
  1022. beginchar(87, 1.2nhw#, apog_nhh#, 0); "Pince";
  1023.     pince(2);
  1024. endchar;
  1025.  
  1026. %<<<>>> .8nhh#
  1027. beginchar(88, 1.8nhw#, apog_nhh#, 0); "???";
  1028.     pince(3);
  1029. endchar;
  1030.  
  1031. %<<<>>> .8nhh#
  1032. beginchar(89, 1.2nhw#, apog_nhh#, 0); "Mordant";
  1033.     pince(2);
  1034.     fill unitsquare xscaled med yscaled 2h shifted ((.5w-.5med),-.5h);
  1035. endchar;
  1036.  
  1037. def arpeg (expr length)=
  1038.     clear;
  1039.     x1=.5w; y1=0; z2=z1+(0,.5nhh); z3=z1+(0,nhh);
  1040.     pickup penrazor scaled (thick+.16nhh) rotated 46;% try 50
  1041.     callpic;
  1042.     draw (z1{ne}..{nw}z2{nw}..{ne}z3) shifted (0, length*nhh);
  1043.     savepic;
  1044.     labels (1,2,3)
  1045. enddef;
  1046.  
  1047. clearpic;
  1048. for jj=0 upto 9:
  1049. %<<<>>>(1+jj)*nhh#
  1050.     beginchar(90+jj, 0.4nhw#, nhh#, 0); "Arpeggio";
  1051.         arpeg(jj);
  1052.     endchar;
  1053. endfor;
  1054.  
  1055. def trill (expr length)=
  1056.     clear;
  1057.     x1=0; y1=.5h; z2=z1+(.5nhw,0); z3=z1+(nhw,0);
  1058.     pickup penrazor scaled 1.4thick rotated 48;
  1059.     callpic;
  1060.     draw (z1{ne}..{se}z2{se}..{ne}z3) shifted (length*nhw, 0);
  1061.     savepic;
  1062.     labels (1,2,3)
  1063. enddef;
  1064.  
  1065. clearpic;
  1066. for jj=0 upto 9:
  1067. %<<<>>>0.45nhh#
  1068.     beginchar(100+jj, (jj+1)*nhw#, 0.5nhh#, 0); "Trille";
  1069.         trill(jj);
  1070.     endchar;
  1071. endfor;
  1072.  
  1073. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1074. % general parameters for small flags %
  1075. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1076. flagw:=0.8nhw*apog_fact;
  1077. flagthick:=apog_nhh;
  1078. flagthin:=5thinwidth*apog_fact;
  1079.  
  1080. beginchar(110, 0, 3apog_nhh#, 0); "Small 1/8flag down";
  1081.     cflag(1);
  1082. endchar;
  1083.  
  1084. beginchar(111, 0, 3.25apog_nhh#, 0); "Small 1/16flag down";
  1085.     ccflag(1);
  1086. endchar;
  1087.  
  1088. beginchar(112, 0, 4.00apog_nhh#, 0); "Small 1/32flag down";
  1089.     cccflag(1);
  1090. endchar;
  1091.  
  1092. beginchar(113, 0, 4.75apog_nhh#, 0); "Small 1/64flag down";
  1093.     ccccflag(1);
  1094. endchar;
  1095.  
  1096. beginchar(114, 0, 5.50apog_nhh#, 0); "Small 1/128flag down";
  1097.     cccccflag(1);
  1098. endchar;
  1099.  
  1100. %%%
  1101. % flags up should be wider
  1102. %%%
  1103. flagw:=nhw*apog_fact;
  1104.  
  1105. beginchar(115, 0, 3apog_nhh#, 0); "Small 1/8flag up";
  1106.     cflag(-1);
  1107. endchar;
  1108.  
  1109. beginchar(116, 0, 3.25apog_nhh#, 0); "Small 1/16flag up";
  1110.     ccflag(-1);
  1111. endchar;
  1112.  
  1113. beginchar(117, 0, 4.00apog_nhh#, 0); "Small 1/32flag up";
  1114.     cccflag(-1);
  1115. endchar;
  1116.  
  1117. beginchar(118, 0, 4.75apog_nhh#, 0); "Small 1/64flag up";
  1118.     ccccflag(-1);
  1119. endchar;
  1120.  
  1121. beginchar(119, 0, 5.50apog_nhh#, 0); "Small 1/128flag up";
  1122.     cccccflag(-1);
  1123. endchar;
  1124.  
  1125. %%%%%%%%%%%%%%%%%%%%%
  1126. % small accidentals %
  1127. %%%%%%%%%%%%%%%%%%%%%
  1128. %<<<>>>2apog_nhh#
  1129. beginchar(120, apog_nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small flat";
  1130.     flat (apog_fact, 0, 1);
  1131.     savepic;
  1132. endchar;
  1133.  
  1134. %<<<>>>2apog_nhh#
  1135. beginchar(121,1.7*apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small doubleflat";
  1136.     callpic;
  1137.     addto currentpicture also currentpicture shifted(0.7apog_fact*nhw,0);
  1138. endchar;
  1139.  
  1140. beginchar(122, 0.8apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small sharp";
  1141.     sharp;
  1142. endchar;
  1143.  
  1144. %<<<>>>.5nhw#
  1145. beginchar(123, apog_nhw#, apog_nhh#, apog_nhh#); "Small doublesharp";
  1146.     doublesharp(.75w);
  1147. endchar;
  1148.  
  1149. beginchar(124, 0.8apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small natural";
  1150.     natural;
  1151. endchar;
  1152.  
  1153. beginchar(125,1.5nhh#, .5nhh#, .5nhh#); "Full note with | -->  |O|";
  1154.     fill unitsquare xscaled thick yscaled nhh shifted (-4/5thick,-d);
  1155.     add_mirror ((w/2, 0),(w/2, 1));
  1156.     drawnoteb(w, h, 0, 85, 0, 1.3thick, thin);
  1157. endchar;
  1158.  
  1159. beginchar(126,0.6nhh#, 4nhh#, 0); "Repeat colons";
  1160.     fill fullcircle scaled 1.2thick shifted (0.5w, 3/8h);
  1161.     add_mirror ((0, h/2),(1, h/2));
  1162. endchar;
  1163.  
  1164. %%%%%%%%%%%
  1165. % rimshot %
  1166. %%%%%%%%%%%
  1167. def caro (expr reduction)=
  1168.     x1=w-w*reduction; y1=y3=0; x2=x4=w-.5w*reduction;
  1169.     x3=w; -y2=y4=0.6nhh*reduction;
  1170.     pickup thin_pen;
  1171.     draw z1--z2; draw z3--z4;
  1172.     pickup pencircle xscaled (.15nhw*reduction) yscaled thinwidth
  1173.                      rotated -45;
  1174.     draw z2--z3; draw z4--z1;
  1175.     labels (1,2,3,4);
  1176. enddef;
  1177.  
  1178. beginchar(127, nhw#, nhh#, nhh#);
  1179.     caro(.95);
  1180. endchar;
  1181.  
  1182.  
  1183. %%%AE some characters are 'kerned' and 'raised' by MusicTeX
  1184. %     this can be done faster with modified fonts and
  1185. %     as an additional advantage, there is more 'main memory' for
  1186. %     future enhancements, for example:
  1187. %
  1188. %\def\w@coli{\selectinstr{\p@loop\raise\altportee
  1189. %  \hbox to \z@{\hss\musicnorfont\char 126\hss}\n@portee\repeat}}%
  1190. %
  1191. %     with
  1192. %
  1193. %beginchar(126, 0, 4nhh#, 0); "Repeat colons";
  1194. %    fill fullcircle scaled 1.2thick shifted (0, 3/8h);
  1195. %    add_mirror ((0, h/2),(1, h/2));
  1196. %endchar;
  1197. %
  1198. %     becomes
  1199. %
  1200. %\def\w@coli{\selectinstr{\p@loop\raise\altportee
  1201. %  \hbox{\musicnorfont\char 126}\n@portee\repeat}}%
  1202. %
  1203. %     or
  1204. %
  1205. %\def\clefdesol{\hbox to 3.2\Interligne{\musickeyfont
  1206. %     \kern -1.2\internote\hss\char"47\hss}}%
  1207. %
  1208. %     with
  1209. %
  1210. %beginchar(71, 8/3nhw#, 5.50nhh#, 2nhh#); "G-clef";
  1211. %    violin(1);
  1212. %endchar;
  1213. %
  1214. %     becomes
  1215. %
  1216. %\def\clefdesol{\hbox{\musickeyfont\char"47}}%
  1217. %
  1218. %     or
  1219. %
  1220. %\def\d@soup{\hbox{\kern -0.3\qn@width\musicnfont\char"3F}}%
  1221. %
  1222. %     with
  1223. %
  1224. %beginchar(63, 2nhh#, 3nhh#, 0); "Quaver rest";
  1225. %     ...
  1226. %    currentpicture:= currentpicture shifted (round(-0.3nhw), 0);
  1227. %endchar;
  1228. %
  1229. %     becomes
  1230. %
  1231. %\def\d@soup{\hbox{\musicnfont\char"3F}}%
  1232. %
  1233. %     and so on
  1234.